package edu.uniquindio.prmaven.proyectofinal;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;

import edu.uniquindio.prmaven.general.TestCore;

public class Autocomplete_2 extends TestCore {
	
	@Test()
	/**
	dataProviderClass = edu.uniquindio.prmaven.dataprovider.DataProviderFactory.class, 
	dataProvider = ConfigurationConstants.DP_FACTORY
	@DataProviderArguments(ConfigurationConstants.ESCENARIO
			+ ConfigurationConstants.EQUALS + DataProvidersConstants.HOJA_1)
			**/
	
	public void testAutocomplete_2() throws Exception {
		
		try {
			
		selenium.open("/showcase/");
		
		//selenium.click("id=SubMenu-Input"); Seleccionar menu Input
		WebElement menuInput=driver.findElement(By.id("SubMenu-Input"));
		menuInput.click();
		
		//selenium.click(".//*[@id='MENUSIDEindent']/div[3]/a[1]"); Seleccionar Submenu Autocomplete
		WebElement submenuAutocomplete=driver.findElement(By.xpath
				("//*[@id='MENUSIDEindent']/div[3]/a[1]"));
		submenuAutocomplete.click();
		
		selenium.waitForPageToLoad("30000");
		
		//Click en .//*[@id='j_idt88:dd']/button... para seleccionar 
		WebElement Dropdown=driver.findElement(By.xpath("//*[@id='j_idt88:dd']/button"));
		Dropdown.click();
		
		//Click seleccion .//*[@id='j_idt88:dd_panel']/ul/li[9] seleccionar numero "8" 
		WebElement opcion=driver.findElement(By.xpath("//*[@id='j_idt88:dd_panel']/ul/li[9]"));
		opcion.click();
		
				
		//selenium.click("id=j_idt88:j_idt117") boton submit
		WebElement submit=driver.findElement(By.id("j_idt88:j_idt117"));
		submit.click();
		
		Assert.assertEquals(selenium.getText("//table[@id='j_idt88:output']/tbody/tr[6]/td[2]"), "8");
		
		//selenium.click("css=span.ui-icon.ui-icon-closethick");
		WebElement cerrar=driver.findElement(By.cssSelector("span.ui-icon.ui-icon-closethick"));
		cerrar.click();
		
		selenium.waitForPageToLoad("5000");
		
	}catch(AssertionError e){
		System.out.println("no se encontro texto");
	}finally{
		
	}
}

}


